package com.activenetwork.smlite.page;

import com.activenetwork.custom.uielement.UIElement;
import com.activenetwork.custom.uielement.decorate.InJson;
import com.activenetwork.smlite.page.generic.ModelPage;
import com.activenetwork.util.EnvContext;
import com.activenetwork.util.PageLoader;

public class LoginPage extends ModelPage{
	
	@InJson
	private UIElement UserName;
	@InJson
	private UIElement UserPassword;
	@InJson
	private UIElement LoginBtn;
	@InJson
	private UIElement CreateAccountBtn;
	@InJson
	private UIElement EmailAddressLabel;
	@InJson
	private UIElement PasswordLabel;
	@InJson
	private UIElement ForgetPassword;
	
	
	/**
	 * Navigate to the login page
	 * @param url
	 * @return
	 */
	public static LoginPage getCurrentPage(String url){
		EnvContext.webDriverTL.get().get(url);
		return PageLoader.load(LoginPage.class);
	}
	
	public void inputUserName(String userName){
		UserName.clear();
		UserName.sendKeys(userName);
	}
	
	public void inputUserPassword(String pwd){
		UserPassword.clear();
		UserPassword.sendKeys(pwd);
	}
	
	public void clickLogin(){
		LoginBtn.click();
	}
	
	public void clickCreateAccount(){
		CreateAccountBtn.click();
	}
	
	public String getEmailAddressLabel(){
		return EmailAddressLabel.getText().trim();
	}
	
	public String getPasswordLabel(){
		return PasswordLabel.getText().trim();
	}
	
	public void clickForgetPassword(){
		ForgetPassword.click();
	}
}
